#include <iostream>
#include <algorithm>
#include <iterator>
#include <vector>
#include <string>
#include "downloadHelp.h"
using std::string;
using std::cout;
using std::endl;

int str_substr(string &row, size_t &pos, size_t &rowPos)
{
    rowPos = row.find_last_of(' ') + 1;
    cout << "response = " << row << "   " << rowPos << endl;
    std::string name = row.substr(rowPos, row.length());
    if (name.size() == 0 || name[0] == '.')
    {
        return -1;
    }
    cout << "name = " << name << endl;

    char ch = '\n';
    auto it = std::find(name.rbegin(), name.rend(), ch);

    pos = std::distance(name.begin(), (it + 1).base());
    FILE_INFO fileInfo;
    fileInfo.name = name.substr(0, rowPos);

    rowPos = row.find_first_of(' ');
    std::string data = row.substr(1, rowPos);
    cout << "name = " << fileInfo.name << endl;
}
